﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;

namespace CommonManagement
{
    /// <summary>
    /// 账户控制器
    /// </summary>
    [RemoteService]
    [Area("commonManagement")]
    [Route("api/commonManagement")]
    public class AccountController : AbpController, IAccountAppService
    {
        private readonly IAccountAppService _accountAppService;

        public AccountController(
            IAccountAppService accountAppService)
        {
            _accountAppService = accountAppService;
        }

        // 1.1.1 用户登录
        [HttpPost]
        [Route("login")]
        public Task<LoginResponse> LoginAsync(LoginDto input)
        {
            return _accountAppService.LoginAsync(input);
        }

        // 1.1.2 用户注册
        [HttpPost]
        [Route("register")]
        public Task<RegisterResponse> RegisterAsync(RegisterDto input)
        {
            return _accountAppService.RegisterAsync(input);
        }
    }
}